package com.leyou.common.utils;

import org.apache.commons.lang3.RandomStringUtils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author xhh
 * @describe 描述
 * @date 2022/7/15 15:56
 * @ClassName GenrateNumbber
 */
public class GenerateNumber {

    public static String  getNumber(String userId){
        StringBuffer stringBuffer=new StringBuffer();
        DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
        LocalDateTime localDateTime=LocalDateTime.now();
        String format = localDateTime.format(ofPattern);
        String s = RandomStringUtils.randomNumeric(3);
        userId=RandomStringUtils.randomNumeric(5);
        return stringBuffer.append(format).append(s).append(userId).toString();
    }
}
